\section{sdo\+\_\+request.\+c File Reference}
\label{sdo__request_8c}\index{sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}}


Canopen over Ether\+C\+AT S\+DO request functions.  


\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{sdo__request_8c_a90de0444ea60b7bb1d18233f1152b249}} 
\#define \textbf{ E\+C\+\_\+\+S\+D\+O\+\_\+\+R\+E\+Q\+U\+E\+S\+T\+\_\+\+R\+E\+S\+P\+O\+N\+S\+E\+\_\+\+T\+I\+M\+E\+O\+UT}~1000
\begin{DoxyCompactList}\small\item\em Default timeout in ms to wait for S\+DO transfer responses. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+clear\+\_\+data} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em S\+DO request destructor. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+init} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em S\+DO request constructor. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+clear} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em S\+DO request destructor. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+copy} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req, const \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$other)
\begin{DoxyCompactList}\small\item\em Copy another S\+DO request. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+alloc} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Pre-\/allocates the data memory. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+copy\+\_\+data} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req, const uint8\+\_\+t $\ast$source, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Copies S\+DO data from an external source. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+timed\+\_\+out} (const \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Checks, if the timeout was exceeded. \end{DoxyCompactList}\item 
void \textbf{ ecrt\+\_\+sdo\+\_\+request\+\_\+index} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req, uint16\+\_\+t index, uint8\+\_\+t subindex)
\begin{DoxyCompactList}\small\item\em Set the S\+DO index and subindex. \end{DoxyCompactList}\item 
void \textbf{ ecrt\+\_\+sdo\+\_\+request\+\_\+timeout} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req, uint32\+\_\+t timeout)
\begin{DoxyCompactList}\small\item\em Set the timeout for an S\+DO request. \end{DoxyCompactList}\item 
uint8\+\_\+t $\ast$ \textbf{ ecrt\+\_\+sdo\+\_\+request\+\_\+data} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Access to the S\+DO request\textquotesingle{}s data. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ ecrt\+\_\+sdo\+\_\+request\+\_\+data\+\_\+size} (const \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Returns the current S\+DO data size. \end{DoxyCompactList}\item 
\textbf{ ec\+\_\+request\+\_\+state\+\_\+t} \textbf{ ecrt\+\_\+sdo\+\_\+request\+\_\+state} (const \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Get the current state of the S\+DO request. \end{DoxyCompactList}\item 
void \textbf{ ecrt\+\_\+sdo\+\_\+request\+\_\+read} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Schedule an S\+DO read operation. \end{DoxyCompactList}\item 
void \textbf{ ecrt\+\_\+sdo\+\_\+request\+\_\+write} (\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Schedule an S\+DO write operation. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Canopen over Ether\+C\+AT S\+DO request functions. 



\subsection{Function Documentation}
\mbox{\label{sdo__request_8c_af17eb98fdb8755c76a4500ed5be4233c}} 
\index{sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}!ec\+\_\+sdo\+\_\+request\+\_\+clear\+\_\+data@{ec\+\_\+sdo\+\_\+request\+\_\+clear\+\_\+data}}
\index{ec\+\_\+sdo\+\_\+request\+\_\+clear\+\_\+data@{ec\+\_\+sdo\+\_\+request\+\_\+clear\+\_\+data}!sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}}
\subsubsection{ec\+\_\+sdo\+\_\+request\+\_\+clear\+\_\+data()}
{\footnotesize\ttfamily void ec\+\_\+sdo\+\_\+request\+\_\+clear\+\_\+data (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



S\+DO request destructor. 


\begin{DoxyParams}{Parameters}
{\em req} & S\+DO request. \\
\hline
\end{DoxyParams}


Definition at line 106 of file sdo\+\_\+request.\+c.

\mbox{\label{sdo__request_8c_a0e62e96b9d01ab1b89cc2df89d0ac8ef}} 
\index{sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}!ec\+\_\+sdo\+\_\+request\+\_\+init@{ec\+\_\+sdo\+\_\+request\+\_\+init}}
\index{ec\+\_\+sdo\+\_\+request\+\_\+init@{ec\+\_\+sdo\+\_\+request\+\_\+init}!sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}}
\subsubsection{ec\+\_\+sdo\+\_\+request\+\_\+init()}
{\footnotesize\ttfamily void ec\+\_\+sdo\+\_\+request\+\_\+init (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



S\+DO request constructor. 


\begin{DoxyParams}{Parameters}
{\em req} & S\+DO request. \\
\hline
\end{DoxyParams}


Definition at line 56 of file sdo\+\_\+request.\+c.

\mbox{\label{sdo__request_8c_af3a555948ca6b916238e6c696d676645}} 
\index{sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}!ec\+\_\+sdo\+\_\+request\+\_\+clear@{ec\+\_\+sdo\+\_\+request\+\_\+clear}}
\index{ec\+\_\+sdo\+\_\+request\+\_\+clear@{ec\+\_\+sdo\+\_\+request\+\_\+clear}!sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}}
\subsubsection{ec\+\_\+sdo\+\_\+request\+\_\+clear()}
{\footnotesize\ttfamily void ec\+\_\+sdo\+\_\+request\+\_\+clear (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



S\+DO request destructor. 


\begin{DoxyParams}{Parameters}
{\em req} & S\+DO request. \\
\hline
\end{DoxyParams}


Definition at line 76 of file sdo\+\_\+request.\+c.

\mbox{\label{sdo__request_8c_a70e89eac4d08148fb507ec32756738b8}} 
\index{sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}!ec\+\_\+sdo\+\_\+request\+\_\+copy@{ec\+\_\+sdo\+\_\+request\+\_\+copy}}
\index{ec\+\_\+sdo\+\_\+request\+\_\+copy@{ec\+\_\+sdo\+\_\+request\+\_\+copy}!sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}}
\subsubsection{ec\+\_\+sdo\+\_\+request\+\_\+copy()}
{\footnotesize\ttfamily int ec\+\_\+sdo\+\_\+request\+\_\+copy (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$}]{req,  }\item[{const \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$}]{other }\end{DoxyParamCaption})}



Copy another S\+DO request. 

\begin{DoxyAttention}{Attention}
Only the index subindex and data are copied.
\end{DoxyAttention}
\begin{DoxyReturn}{Returns}
Zero on success, otherwise a negative error code. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em req} & S\+DO request. \\
\hline
{\em other} & Other S\+DO request to copy from. \\
\hline
\end{DoxyParams}


Definition at line 91 of file sdo\+\_\+request.\+c.

\mbox{\label{sdo__request_8c_a2f1e920bf54c7826a9747beae685caf4}} 
\index{sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}!ec\+\_\+sdo\+\_\+request\+\_\+alloc@{ec\+\_\+sdo\+\_\+request\+\_\+alloc}}
\index{ec\+\_\+sdo\+\_\+request\+\_\+alloc@{ec\+\_\+sdo\+\_\+request\+\_\+alloc}!sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}}
\subsubsection{ec\+\_\+sdo\+\_\+request\+\_\+alloc()}
{\footnotesize\ttfamily int ec\+\_\+sdo\+\_\+request\+\_\+alloc (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$}]{req,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



Pre-\/allocates the data memory. 

If the {\itshape mem\+\_\+size} is already bigger than {\itshape size}, nothing is done.

\begin{DoxyReturn}{Returns}
0 on success, otherwise -\/\+E\+N\+O\+M\+EM. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em req} & S\+DO request. \\
\hline
{\em size} & Data size to allocate. \\
\hline
\end{DoxyParams}


Definition at line 127 of file sdo\+\_\+request.\+c.

\mbox{\label{sdo__request_8c_af41428fb76fbb3a2bcf14a269a265476}} 
\index{sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}!ec\+\_\+sdo\+\_\+request\+\_\+copy\+\_\+data@{ec\+\_\+sdo\+\_\+request\+\_\+copy\+\_\+data}}
\index{ec\+\_\+sdo\+\_\+request\+\_\+copy\+\_\+data@{ec\+\_\+sdo\+\_\+request\+\_\+copy\+\_\+data}!sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}}
\subsubsection{ec\+\_\+sdo\+\_\+request\+\_\+copy\+\_\+data()}
{\footnotesize\ttfamily int ec\+\_\+sdo\+\_\+request\+\_\+copy\+\_\+data (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$}]{req,  }\item[{const uint8\+\_\+t $\ast$}]{source,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



Copies S\+DO data from an external source. 

If the {\itshape mem\+\_\+size} is to small, new memory is allocated.


\begin{DoxyRetVals}{Return values}
{\em 0} & Success. \\
\hline
{\em $<$0} & Error code. \\
\hline
\end{DoxyRetVals}

\begin{DoxyParams}{Parameters}
{\em req} & S\+DO request. \\
\hline
{\em source} & Source data. \\
\hline
{\em size} & Number of bytes in {\itshape source}. \\
\hline
\end{DoxyParams}


Definition at line 156 of file sdo\+\_\+request.\+c.

\mbox{\label{sdo__request_8c_a4cf7dda2b74244c093448636f7584d60}} 
\index{sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}!ec\+\_\+sdo\+\_\+request\+\_\+timed\+\_\+out@{ec\+\_\+sdo\+\_\+request\+\_\+timed\+\_\+out}}
\index{ec\+\_\+sdo\+\_\+request\+\_\+timed\+\_\+out@{ec\+\_\+sdo\+\_\+request\+\_\+timed\+\_\+out}!sdo\+\_\+request.\+c@{sdo\+\_\+request.\+c}}
\subsubsection{ec\+\_\+sdo\+\_\+request\+\_\+timed\+\_\+out()}
{\footnotesize\ttfamily int ec\+\_\+sdo\+\_\+request\+\_\+timed\+\_\+out (\begin{DoxyParamCaption}\item[{const \textbf{ ec\+\_\+sdo\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



Checks, if the timeout was exceeded. 

\begin{DoxyReturn}{Returns}
non-\/zero if the timeout was exceeded, else zero. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em req} & S\+DO request. \\
\hline
\end{DoxyParams}


Definition at line 177 of file sdo\+\_\+request.\+c.

